package com.smvc.handlers;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.smvc.entities.User;

@Controller
public class UserController {
	
	@RequestMapping(value="reg",method=RequestMethod.GET)
	public String toLogin(Model model){
		model.addAttribute("user", new User());
		return "reg";
	}
	
	@RequestMapping(value="reg",method=RequestMethod.POST)
	public String doReg(User u){
		System.out.println(u);
		return "redirect:/index.jsp";
	}
}
